#include "exti.h"
#include "delay.h"
#include "led.h"
#include "beep.h"
#include "key.h"
#include "stm32f10x.h"
#include "sys.h"

void EXTI0_IRQHandler(void)
{
	delay_ms(10);
	if(wkup==1)beep=!beep;
	EXTI->PR=1<<0;
}
void EXTI3_IRQHandler(void)
{
	delay_ms(10);
	if(key0==0)ds0=!ds0;
	EXTI->PR=1<<3;
}
void EXTI4_IRQHandler(void)
{
	delay_ms(10);
	if(key1==0)ds1=!ds1;
	EXTI->PR=1<<4;
}

void extixinit(void)
{
	keyinit();
	Ex_NVIC_Config(GPIO_A,0,RTIR); //上升沿触发
	Ex_NVIC_Config(GPIO_E,3,FTIR); //下降沿触发
	Ex_NVIC_Config(GPIO_E,4,FTIR); //下降沿触发
	MY_NVIC_Init(2,3,EXTI0_IRQn,2);
	MY_NVIC_Init(2,1,EXTI3_IRQn,2);
	MY_NVIC_Init(2,0,EXTI4_IRQn,2);
}
